package cn.yanhu.kuwanapp.my.adapter

import android.content.Context
import android.graphics.Color
import android.widget.TextView
import cn.woochen.comlib.adapter.CommonRecyclerAdapter
import cn.yanhu.kuwanapp.R
import cn.yanhu.kuwanapp.bean.response.RespWithdrawRecordBean
import cn.yanhu.kuwanapp.databinding.ItemWithdrawRecordBinding

class WithdrawRecordAdapter constructor(datas: List<RespWithdrawRecordBean.Record>) :
    CommonRecyclerAdapter<RespWithdrawRecordBean.Record>(datas, R.layout.item_withdraw_record) {

    override fun convert(holder: ViewHolder, item: RespWithdrawRecordBean.Record) {
        holder.getDataBinding<ItemWithdrawRecordBinding?>()?.let {
            it.itemBean = item
            val money = item.money.toIntOrNull() ?: 0
            if (money < 0) {
                it.tvWithdrawMoney.setTextColor(Color.parseColor("#333333"))
            } else {
                it.tvWithdrawMoney.setTextColor(Color.parseColor("#FF6E28"))
            }
        }
    }

}